<div id="content">
  <h3>分类文章列表</h3>
  <ul>
    <?php
      global $wpdb;
      $request = "SELECT $wpdb->terms.term_id, name FROM $wpdb->terms ";
      $request .= " LEFT JOIN $wpdb->term_taxonomy ON $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id ";
      $request .= " WHERE $wpdb->term_taxonomy.taxonomy = 'category' ";
      $request .= " ORDER BY term_id asc";
      $categorys = $wpdb->get_results($request);

      foreach ($categorys as $category)
      {
        $catname = $category->name;
        $catid = $category->term_id;
    ?>
        <li>
          <input type="checkbox" class="ckcate" name="ckcate" value="<?php echo $catid;?>" onclick="cateck(this)" />
          <?php echo $catname;?>
          &nbsp;&nbsp;

          <span style="font-size:12px;color:red;">系统分类：<span>
          <select class="syscatelist"  catid="<?php echo $catid;?>">
              <?php
              if(token !="")
              {
                foreach($syscate as $cate )
                {
                  $syscateid = $cate["id"];
                  $syscatename = $cate["name"];
              ?>
                <option value="<?php echo $syscateid;?>"><?php echo $syscatename;?></option>
              <?php
                }
              }?>
          </select>

          <span style="font-size:12px;color:red;">用户分类：<span>
          <select class="usercatelist"  catid="<?php echo $catid;?>">
              <?php
              if(token !="")
              {
                foreach($usercate as $cate )
                {
                  $usercateid = $cate["id"];
                  $usercatename = $cate["name"];
              ?>
                <option value="<?php echo $usercateid;?>"><?php echo $usercatename;?></option>
              <?php
                }
              }?>
          </select>


        </li>
        <ul>
          <?php
            $catposts = new WP_Query();
            $catposts->query('cat='.$catid);
            while ($catposts->have_posts()) : $catposts->the_post();
          ?>
          <li>
            <input type="checkbox" class="ckpost" name="ckpost" catid="<?php echo $catid;?>" value="<?php the_ID()?>"/>
            <a href="<?php the_permalink(); ?>" target="_blank">
              <?php the_title(); ?>
            </a>
          </li>
          <?php endwhile;?>
        </ul>
    <?php } ?>
  </ul>
</div>
